﻿using System;
using FluentValidation.Results;

namespace ECommerce.Web
{
    public class ValidationException : Exception
    {
        private readonly ValidationResult result = new ValidationResult();

        public ValidationException(string key, string message) : base(message)
        {
            this.result.Errors.Add(new ValidationFailure(key, message));
        }

        public ValidationException(ValidationResult result)
        {
            this.result = result;
        }

        public ValidationResult Result
        {
            get { return this.result; }
        }
    }
}
